package com.rp.system.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.rp.common.utils.RpUtil;
import com.rp.log.annotation.RpLog;
import com.rp.system.dao.ButtonDao;
import com.rp.system.po.Button;

@Service
@Transactional
public class ButtonService {

	@Autowired
	private ButtonDao buttonDao;
	
	@RpLog(desc="新增按钮")
	public String addButton(Button button, String moduleAlias){
		button.setId(RpUtil.createGuid());
		button.setCreateDate(RpUtil.getCurrentDatetime());
		button.setModuleAlias(moduleAlias);
		return (String) buttonDao.save(button);
	}
	
	@RpLog(desc="更新按钮")
	public void updateButton(Button button){
		button.setUpdateDate(RpUtil.getCurrentDatetime());
		buttonDao.update(button);
	}
	
	@RpLog(desc="删除按钮")
	public void deleteButton(Button button){
		buttonDao.delete(button);
	}
	
	
	public ButtonDao getButtonDao() {
		return buttonDao;
	}
	
}
